package com.yhzdys.ocr.controller;

import com.yhzdys.ocr.service.OcrService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Slf4j
@RestController
public class OcrController {

    @Resource
    private OcrService ocrService;

    @PostMapping("/ocr")
    public Object ocr(@RequestBody List<String> urls) {
        log.info("ocr recognize start");
        Map<String, List<String>> result = ocrService.recognize(urls);
        log.info("ocr recognize finish");
        return result;
    }
}
